package com.property.demo.repository;

import com.property.demo.model.Permission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface PermissionRepository extends JpaRepository<Permission, Long> {
    
    Optional<Permission> findByCode(String code);
    
    Boolean existsByCode(String code);
    
    List<Permission> findByParentIdOrderBySort(Long parentId);
    
    List<Permission> findByParentIdIsNullOrderBySort();
} 